<?php
	include "../../public/commom/config.php";
	include "../lock1.php";		
	
	if($_POST){
		$name = $_POST['name'];
		
		$sql1 = "SELECT * FROM status WHERE name = '$name'";
		
		$result1 = mysqli_query($conn, $sql1);
		
		$num = mysqli_num_rows($result1);
		
		if(!$num) {
			$sql = "INSERT INTO status (name) VALUES ('$name')";
			
			$result = mysqli_query($conn, $sql);
			
			mysqli_close($conn);
				
			header("Location: ./index.php");
		} else {
			echo "状态已存在";
		}
	}
?>